package com.wens.monitor.dao;

import java.util.Date;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.wens.monitor.model.Performancedata;
import com.wens.monitor.model.Processdata;


public class ProcessdataDAO extends DAO {

	public static List<Processdata> getRecords(Date startDate,
			Date endDate, String IP, String processName) {
		Session session = factory.getCurrentSession();
		session.beginTransaction();
		Query q = session.createQuery("from Processdata p where p.monitor.server.IP = :IP " +
				"and p.monitor.process.name = :processName and" +
				"p.createDate between :startDate and :endDate")
				.setDate("startDate", startDate)
				.setDate("endDate", endDate)
				.setString("IP", IP)
				.setString("processName", processName);
		List<Processdata> list = q.list();
		session.getTransaction().commit();
		return list;
	}
}
